package com.lb.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration
public class RedissonConfig {

 //      config.useClusterServers()
 //              .setPassword("yourpassword") // 替换为你的密码
 //              .addNodeAddress(
 //                      "redis://47.120.36.156:30001",
 //                              "redis://47.120.36.156:30002",
 //                              "redis://47.120.36.156:30003",
 //                              "redis://47.120.36.156:30004",
 //                              "redis://47.120.36.156:30005",
 //                              "redis://47.120.36.156:30006"
 //  );

 //  redissonClient = org.redisson.Redisson.create(config);
 @Bean(destroyMethod = "shutdown")

 public RedissonClient redissonClient(){
     Config config = new Config();
        config.useClusterServers()
                .setPassword("yourpassword") // 替换为你的密码
                .addNodeAddress(
                        "redis://47.120.36.156:30001",
                        "redis://47.120.36.156:30002",
                        "redis://47.120.36.156:30003",
                        "redis://47.120.36.156:30004",
                        "redis://47.120.36.156:30005"
                       );
        RedissonClient client = Redisson.create(config);
       // System.out.println("🎉 RedissonClient 已初始化，连接集群: " + clusterNodes);
        return client;
    }

}
